package cn.community.care.module.system.dal.mysql.info;

import java.util.*;

import cn.community.care.framework.common.pojo.PageResult;
import cn.community.care.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.community.care.framework.mybatis.core.mapper.BaseMapperX;
import cn.community.care.module.system.controller.admin.info.vo.InfoPageReqVO;
import cn.community.care.module.system.dal.dataobject.info.InfoDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 房间信息 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface InfoMapper extends BaseMapperX<InfoDO> {

    default PageResult<InfoDO> selectPage(InfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoDO>()
                .eqIfPresent(InfoDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InfoDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InfoDO::getBuildingNumber, reqVO.getBuildingNumber())
                .eqIfPresent(InfoDO::getFloorNumber, reqVO.getFloorNumber())
                .eqIfPresent(InfoDO::getRoomNumber, reqVO.getRoomNumber())
                .eqIfPresent(InfoDO::getType, reqVO.getType())
                .eqIfPresent(InfoDO::getParentNumber, reqVO.getParentNumber())
                .betweenIfPresent(InfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoDO::getId));
    }

}